<template>
  <el-form ref="form" :model="form" label-width="80px">
    <el-form-item label="部门">
      <el-select v-model="form.departmentid" placeholder="请选择">
        <el-option v-for="item in options" :key="item.id" :label="item.departmenName" :value="item.id">
        </el-option>
      </el-select>
    </el-form-item>

    <el-form-item label="职位">
      <el-select v-model="form.positionid" placeholder="请选择">
        <el-option v-for="item in options1" :key="item.id" :label="item.position" :value="item.id">
        </el-option>
      </el-select>
    </el-form-item>

    <el-form-item label="审批状态">
      <el-select v-model="form.examinationid" placeholder="请选择">
        <el-option v-for="item in options2" :key="item.id" :label="item.examination" :value="item.id">
        </el-option>
      </el-select>
    </el-form-item>

    <el-form-item label="姓名">
      <el-input v-model="form.name"></el-input>
    </el-form-item>
    <el-form-item label="上级负责人">
      <el-input v-model="form.responsible"></el-input>
    </el-form-item>
    <el-form-item label="入职日期" type="date">
      <el-input v-model="form.dateentry" placeholder="审批人" type="date"></el-input>
    </el-form-item>

    <el-form-item label="最后工作日日期" type="date">
      <el-input v-model="form.workingday" placeholder="审批人" type="date"></el-input>
    </el-form-item>
    <el-form-item label="离职状态">
      <el-input v-model="form.leavingreason"></el-input>
    </el-form-item>
    <el-form-item label="创建时间" type="date">
      <el-input v-model="form.creationtime" placeholder="审批人" type="date"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="updatee">立即创建</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
</template>
<script>
export default {
  data () {
    return {
      form: {
        responsible: "",
        departmentid: '',
        positionid: '',
        examinationid: '',
        name: '',
        leavingreason: '',
        creationtime: '',
        workingday: '',
        dateentry: ''
      },
      options: [],
      options1: [],
      options2: [],
    }
  },
  created () {
    this.bum();
    this.zhiwei();
    this.shepi();

  },
  methods: {
    onSubmit () {
      console.log('submit!');
    },
    //修改
    updatee () {
      this.$http({
        url: "https://localhost:44357/api/SSk/ManagementtableAdd",
        method: "post",
        data: this.form
      }).then((obj) => {
        alert("添加成功");
        this.$router.push('/LIZhiBanLiShow');
      })
    },


    //部门
    bum () {
      this.$http({
        url: "https://localhost:44357/api/SSk/buma",
        method: "get",
      }).then((obj) => {
        this.options = obj.data;
      })
    },
    //职位
    zhiwei () {
      this.$http({
        url: "https://localhost:44357/api/SSk/zhiw",
        method: "get",
      }).then((obj) => {
        this.options1 = obj.data;
      })
    },
    //审批状态
    shepi () {
      this.$http({
        url: "https://localhost:44357/api/SSk/sp",
        method: "get",
      }).then((obj) => {
        this.options2 = obj.data;
      })
    }
  }
}
</script>
